﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace GameDev
{
    static class Camera
    {
        static Matrix viewMatrix;
        static Matrix projectionMatrix;
        static float theta = 0;
        static double posX = 100;
        static double posY = 50;
        static double posZ = 0;
        static float lookX = 0;
        static float lookY = 0;
        static float lookZ = 0;
        static float radius = 50;

        static public void setUpCamera(GraphicsDevice device)
        {
            viewMatrix = Matrix.CreateLookAt(new Vector3((float)posX, (float)posY, (float)posZ), new Vector3(lookX, lookY, lookZ), new Vector3(0, 1, 0));
            projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 1.0f, 300.0f);
        }


        static public void update()
        {
            theta += 0.001f;
            posX = radius * Math.Cos(theta);
            posZ = radius * Math.Sin(theta);

            viewMatrix = Matrix.CreateLookAt(new Vector3((float)posX, (float)posY, (float)posZ), new Vector3(lookX, lookY, lookZ), new Vector3(0, 1f, 0));

        }

        static public Matrix getViewMatrix()
        {
            return viewMatrix;
        }

        static public Matrix getProjectionMatrix()
        {

            return projectionMatrix;
        }
    }
}
